package zjitc.service.Impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import zjitc.dao.BookMapper;
import zjitc.po.Book;
import zjitc.po.User;
import zjitc.service.BookService;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/12 16:52
 * @description:
 */
@Service
public class BookServiceImpl implements BookService{
@Autowired
private BookMapper bookMapper;
  @Override
  public List<Book> findAllBook() {
    return bookMapper.findAllBook();
  }

  @Override
  public List<Book> findAllByPage(int start, int count) {
      PageHelper.startPage(start,count);
      return bookMapper.findAllBook();
  }

  @Override
  public List<Book> searchBookByName(String name, int start, int count) {
   PageHelper.startPage(start,count);
    return bookMapper.searchBookByName(name);
  }

  //@Override
  //public int deleteBookByBname(String bname) {
  //  return bookMapper.deleteBookByBname(bname);
  //}


  @Override
  public int addBookMessage(Book book) {
    return bookMapper.addBookMessage(book);
  }

  @Override
  public Book findByBsid(Integer bsid) {
    return bookMapper.findByBsid(bsid);
  }

  @Override
  public int updateBookMessage(Book book) {
    return bookMapper.updateBookMessage(book);
  }

  @Override
  public int deleteBookByBsid(int bsid) {
    return bookMapper.deleteBookByBsid(bsid);
  }

  @Override
  public List<Book> findisHotBook() {
    return bookMapper.findisHotBook();
  }

  @Override
  public List<Book> findisNewBook() {
    return bookMapper.findisNewBook();
  }

  @Override
  public List<Book> findBookByCategoryName(String categoryname) {
    return bookMapper.findBookByCategoryName(categoryname);
  }



  @Override
  public List<Book> findBookByCategoryNameByPage(String categoryname, int start, int count) {
    PageHelper.startPage(start,count);
    return bookMapper.findBookByCategoryName(categoryname);
  }

  @Override
  public List<Book> findBookFromCambridge(String str, int start, int count) {
    PageHelper.startPage(start,count);
    return bookMapper.findBookFromCambridge(str);
  }


}
